// https://www.lintcode.com/problem/clone-binary-tree/description?_from=ladder&&fromId=6

/**
 * Definition of TreeNode:
 * class TreeNode {
 * public:
 *     int val;
 *     TreeNode *left, *right;
 *     TreeNode(int val) {
 *         this->val = val;
 *         this->left = this->right = NULL;
 *     }
 * }
 */

class Solution {
public:
    /**
     * @param root: The root of binary tree
     * @return: root of new tree
     */
     
    TreeNode* copy_tree(TreeNode * root)
    {
        if (!root) return NULL;
        TreeNode * new_root = root;
        new_root->left = copy_tree(root->left);
        new_root->right = copy_tree(root->right);
    }
    TreeNode * cloneTree(TreeNode * root) {
        return copy_tree(root);
    }
};